Ext.onReady(function() {
	var toolbar = Ext.create('Ext.toolbar.Toolbar', {
		dock : 'top',
		items : [{
					text : '返回',
					xtype : 'button',
					listeners : {
						click : function() {
							location.href = "/sysMgr/attach_group_mgr";
						}
					}
				}, {
					text : '保存',
					xtype : 'button',
					listeners : {
						click : function() {
							var form = Ext.getCmp("attach_group_form");
							if (!form.isValid()) {
								return;
							}
							Ext.Ajax.request({
								url : '/attach_group/update',
								type : 'POST',
								params : {
									Id : attachmentGroup.Id,
									Name : Ext.getCmp("attach_group_name").getValue(),
									Desp : Ext.getCmp("attach_group_desp").getValue()
								},
								callback : function(options, success, response) {
									if (success) {
										var result = Ext
												.decode(response.responseText);
										if (result.success) {
											location.href = "/sysMgr/attach_group_mgr";
										} else {
											Ext.Msg.alert('错误', result.msg);
										}
									}
								}
							})
						}
					}
				}]
	});

	var detailPanel = Ext.create("Ext.form.Panel", {
				id : "attach_group_form",
				border : false,
				autoScroll : true,
				margin : '5 5',
				items : [{
							xtype : 'container',
							layout : 'hbox',
							margin : '5 0',
							items : [{
										xtype : 'textfield',
										id : "attach_group_name",
										fieldLabel : '名称',
										value : attachmentGroup.Name,
										allowBlank : false
									}]
						}, {
							xtype : 'container',
							layout : 'hbox',
							margin : '5 0',
							items : [{
										xtype : 'textarea',
										width : 400,
										id : "attach_group_desp",
										value : attachmentGroup.Desp,
										fieldLabel : '描述'
									}]
						}]
			});

	var panel = Ext.create("Ext.panel.Panel", {
				title : '',
				border : false,
				bodyBorder : false,
				autoScroll : true,
				layout : 'fit',
				dockedItems : [toolbar],
				items : [detailPanel]
			});
	Ext.create('Ext.Viewport', {
				layout : 'fit',
				style : 'background:none;background-color:white;',
				items : [panel]
			});
});